package com.ruoyi.manage.controller;


import com.ruoyi.common.core.cg.pojo.Community;
import com.ruoyi.common.core.cg.result.Result;
import com.ruoyi.manage.service.CommunityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 马景昌
 * @create 2025/03/12
 * @description
 */
@RestController
@RequestMapping("/community")
public class CommunityController {
    @Autowired
    private CommunityService communityService;
    @GetMapping("/show")
    public Result show(){
        Result show = communityService.show();
        return show;
    }
    @GetMapping("/pageShow")
    public Result pageShow(Community community){
        Result result = communityService.pageShow(community);
//        System.err.println(result.getData());
        return result;
    }
    @GetMapping(value = "/{id}")
    public Result info(@PathVariable("id") Integer id){
        Result result = communityService.info(id);
        return result;
    }
//    修改community
    @PutMapping ("/put")
    public Result put(@RequestBody Community community){
        Result result = communityService.put(community);
        return result;
    }

    //下拉菜单
    @RequestMapping("All")
    public Result All(){
        List<Community> community = communityService.All();
        return new Result(true,"成功",community);
    }

}
